from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import sys
from ui.Ui_my_widget import Ui_MyWidget


class MyWidget(QWidget):

    def __init__(self, title):
        super().__init__()
        self.setWindowTitle(title)
        self.ui = Ui_MyWidget()
        self.ui.setupUi(self)

        self.init_ui()

    def on_click(self):
        print("clicked")

    def init_ui(self):
        self.ui.pushButton.clicked.connect(self.on_click)


if __name__ == '__main__':
    app = QApplication(sys.argv)

    window = MyWidget("窗口标题")
    window.show()

    sys.exit(app.exec_())